ec953b
@@ -64,6 +64,7 @@
public void processOp(Object row, int tag) throws HiveException {
 
   private void processKeyValuePairs(Object key, Object value)
       throws HiveException {
+    String filePath = "";
     try {
       OrcFileValueWrapper v;
       OrcFileKeyWrapper k;
@@ -72,6 +73,7 @@
private void processKeyValuePairs(Object key, Object value)
       } else {
         k = (OrcFileKeyWrapper) key;
       }
+      filePath = k.getInputPath().toUri().getPath();
 
       fixTmpPath(k.getInputPath().getParent());
 
@@ -131,6 +133,16 @@
private void processKeyValuePairs(Object key, Object value)
       this.exception = true;
       closeOp(true);
       throw new HiveException(e);
+    } finally {
+      if (fdis != null) {
+        try {
+          fdis.close();
+        } catch (IOException e) {
+          throw new HiveException(String.format("Unable to close file %s", filePath), e);
+        } finally {
+          fdis = null;
+        }
+      }
     }
   }
 
